
<div id="login" class="warp">
  <div id="main" class="reg">
   <div id="header">
      <div class="title">
        <h1>会员注册</h1>
        <div class="small">login</div>
      </div>
      <div class="fn-clear"></div>
    </div>
  <div class="fn-clear"></div>
  <div class="form">
    <form action="{$url(register/data)}" method="post" id="form">
    	<ul>
            <li><label><span class="red">*</span> 用户名：</label> <input name="username" type="text" class="text" id="username" datatype="s5-12" errormsg="支持5~12位字符，不能有特殊符号" /> <span class="Validform_checktip"></span></li>
            <li><label><span class="red">*</span> 昵 称：</label> <input name="nicename" type="text" class="text" id="nicename" datatype="s2-20" errormsg="昵称支持1~12位中英文数字" /> <span class="Validform_checktip"></span></li>
            <li><label><span class="red">*</span> 密 码：</label> <input name="password" type="password" class="text" id="password" datatype="*6-16" errormsg="密码只支持6~16位字符"  /> <span class="Validform_checktip"></span></li>
            <li><label><span class="red">*</span> 重复密码：</label> <input name="password2" type="password" class="text" id="password2" recheck="password" datatype="*6-16" errormsg="确认密码不正确" /> <span class="Validform_checktip"></span> </li>
            <li><label><span class="red">*</span> Email：</label> <input name="email" type="text" class="text" id="email" datatype="e" errormsg="请输入正确的邮箱地址" /> <span class="Validform_checktip"></span> </li>
            <li><label><span class="red">*</span> 手机：</label> <input name="tel" type="text" class="text" id="tel" datatype="m" errormsg="请输入正确的手机号码" /> <span class="Validform_checktip"></span> </li>
             <li>
            <label><span class="red">*</span> 所在地：</label> 
            <select name="province" id="province"  onchange="loadregion();" >
            <option value="0">省份/直辖市</option>
            <!--foreach:{$province_list $vo}-->
            <option value="{$vo.id}">{$vo.name}</option>
            <!--{/foreach}-->
          </select>
          &nbsp;&nbsp;<select name="city" id="city">
       		<option value="0">市/县</option>
     		</select>
            </li>
            <li><label><span class="red">*</span> 街道地址：</label> <input name="address" type="text" class="text" id="address" datatype="s3-200" errormsg="请输入正确的公司地址" /> <span class="Validform_checktip"></span> </li>
            
            <li><label>QQ：</label> <input name="qq" type="text" class="text" id="qq" datatype="qq" ignore="ignore" errormsg="请输入正确的qq号码" /> <span class="Validform_checktip"></span> </li>
           
            
            <li><label>注册条款</label> <input name="agreement" id="agreement" type="checkbox" datatype="*" nullmsg="必须同意条款才可注册" value="1"> 我已仔细阅读并同意<a href="javascript:;" id="agreement_html">注册协议</a> <span class="Validform_checktip"></span></li>
            <li><label></label> <button class="button" type="submit">注册</button> <span id="tip" class="load"></span></li>
        </ul>
    </form>
    </div>
  <div class="fn-clear"></div>
  <div class="sep10"></div>
  <div class="sep10"></div>
  <div class="sep10"></div>
  <div class="sep10"></div>
  </div>
</div>

<script>
var loadregion = new function(){}; 
Do.ready('userbase','form','dialog', function() {
	window.loadregion=function loadregion(){
		$("#city option").each(function(){
			$(this).remove();
		});
		$("<option value=0>请选择</option>").appendTo($("#city"));
		if($("#province").val()==0){
			return;
		}
		$.post('{$url(register/get_province)}',{pid:$("#province").val(),type:2},
			function(json){
				if(json.status=='y'){
					$.each(json.info,function(idx,item){
						$("<option value="+item.id+">"+item.name+"</option>").appendTo($("#city"));
					});
				}else{
					$("<option value='0'>请选择</option>").appendTo($("#city"));
				}
			},'json'
		);
	}
	$('#agreement_html').click(function() {
		var dialog = art.dialog({title: false});
        $.ajax({
			url: '{$url(register/agreement)}',
			success: function (data) {
				dialog.content(data);
			}
		});
    });
	saveform(function(){
		art.dialog({
			content: '恭喜您注册成功，请使用您注册的帐号密码进行登录！',
			icon: 'succeed',
			ok: function () {
				window.location.href="{$url(login/index)}";
				return false;
			},
			cancelVal: '关闭',
			cancel: function() {
				window.location.href="{$url(login/index)}";
			}
		});
		
	});
});
</script>